package edu.task.snake.controller;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;


public class KAdapter extends KeyAdapter {
    private SnakeController snakeController;

    public KAdapter(SnakeController snakeController) {
        this.snakeController = snakeController;
    }

    @Override
    public void keyPressed(KeyEvent e) {
        int key = e.getKeyCode();
        if (key == KeyEvent.VK_LEFT) {
            snakeController.changeDirection("left");
        }
        if (key == KeyEvent.VK_RIGHT) {
            snakeController.changeDirection("right");
        }
    }
}
